<?php

namespace IDock\Insurance\AICS\Request;

use IDock\Insurance\AICS\Response\VehicleModelResponse;
use IDock\Insurance\AICS\Request\AllAICSRequest;
use IDock\Visitor\VehicleModelVisitor;

class VehicleModelRequest extends AllAICSRequest
{
    public $code = 'newQueryVehicleTypesService';
    public $envelopeName = 'new:queryVehicleTypesService';

    protected $response = VehicleModelResponse::class;

    protected $urlTip = '车型查询';

    /**
     * @var  VehicleModelVisitor $visitor
     */
    protected $visitor;

    public function generate(): array
    {
        $firstRegDate = date('Ymd',strtotime($this->visitor->firstRegisterDate));
        $modelName = str_replace("牌",'',$this->visitor->vehicleModel);
        return [
            'searchKeyword' => $modelName,
            'engineNo' => $this->visitor->engineNo,
            'vid' => $this->visitor->vin,
            'dptCde' => $this->visitor->argc['dptCde'] ?? '0580',
            'prono' =>  $this->visitor->argc['prono'] ?? '0364',
            'motorTypeCode' => $this->visitor->argc['motorTypeCode'] ?? '337001',
            'cFstRegYm' => $firstRegDate,
        ];
    }
}
